package com.etc.entity;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
//@RequestMapping(value = { "a", "ab" }) // 定义一个映射地址
@RequestMapping("ttt")
public class AppleBeanController {

	@RequestMapping("test1")
	public String test1() {

		return "";
	}

	@RequestMapping("test2/{userId}") // 将占位符的值，映射到方法的参数位置
	public String test2(@PathVariable("userId") int userId) {

		return "";
	}

	@RequestMapping("test3") // 将可以传递参数，映射到方法的参数位置,可以设置其特征
	public String test3(@RequestParam(value = "userName", required = true, defaultValue = "abc") String userName) {

		return "";
	}

	@RequestMapping("test4")  //读取本地cookie的key为cookieName的值
	public String test4(@CookieValue(value="cookieName") String cookieName) {
		return "";

	}
	
	
	//@RequestBody  将json格式的字符串传递到映射方法的参数
	//@ResponseBody 响应结果为json对象
	
	

}
